package com.jiazhong.spring.autowired;


import com.jiazhong.spring.autowired.config.SpringConfig;
import com.jiazhong.spring.autowired.controller.UserController;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Auther:shuXin
 */
public class UserTest {
    @Test
    public void test01() {
        ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
        UserController userController = ac.getBean("userController", UserController.class);
        userController.save();
    }

    @Test
    public void test02() {
        ApplicationContext ac = new AnnotationConfigApplicationContext(SpringConfig.class);
        UserController bean = ac.getBean(UserController.class);
        bean.save();

    }
}
